﻿/*****************************************************************//**
 * @file    FITKGraphObjectLoad_F_M.h
 * @brief   Graph object for concentrated force and moment data.
 *
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-04-09
 *********************************************************************/

#ifndef __FITKGRAPHOBJECTLOAD_F_M_H__
#define __FITKGRAPHOBJECTLOAD_F_M_H__

#include "FITKGraphObjectNodeLoadBase.h"

#include "FITKVTKGraphAdaptorAPI.h"

// Forward declaration
class FITKGraphActor;

namespace Comp
{
    class FITKGraphRender;
}

namespace Interface
{
    class FITKModelSet;
    class FITKAbaRefPoint;
    class FITKBoundaryLocation;
    class FITKAbaLoadConcentratedForce;
    class FITKAbaLoadMoment;
    class FITKAbstractAssInstance;
    class FITKCoordinateSystem;
}

namespace Exchange
{
    /**
     * @brief   Graph object for fixed-sized concentrated force and moment.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-04-09
     */
    class FITKVTKGRAPHADAPTORAPI FITKGraphObjectLoad_F_M : public FITKGraphObjectNodeLoadBase
    {
        // Regist
        FITKGraphObjectRegist(FITKGraphObjectLoad_F_M, FITKGraphObjectNodeLoadBase);
        FITKCLASS(Exchange, FITKGraphObjectLoad_F_M);

    public:
        /**
         * @brief   Constructor.
         * @param   caseData: The case data
         * @param   forceData: The force data object
         * @param   stepId: The step id
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-09
         */
        FITKGraphObjectLoad_F_M(AbaqusData::FITKDataCase* caseData, Interface::FITKAbaLoadConcentratedForce* forceData, int stepId);

        /**
         * @brief   Constructor.
         * @param   caseData: The case data
         * @param   momentData: The moment data object
         * @param   stepId: The step id
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-09
         */
        FITKGraphObjectLoad_F_M(AbaqusData::FITKDataCase* caseData, Interface::FITKAbaLoadMoment* momentData, int stepId);

        ///**
        // * @brief   Constructor.
        // * @param   caseData: The case data
        // * @param   lineData: The line load data object
        // * @param   stepId: The step id
        // * @author  ChengHaotian (yeguangbaozi@foxmail.com)
        // * @date    2024-07-10
        // */
        //FITKGraphObjectLoad_F_M(AbaqusData::FITKDataCase* caseData, Interface::* lineData, int stepId);

        /**
         * @brief   Destructor.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-09
         */
        virtual ~FITKGraphObjectLoad_F_M() = default;

    private:
        /**
         * @brief   Get the value to member variables.[override]
         * @param   stepId: The step id
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-13
         */
        void getValue(int stepId) override;

        /**
         * @brief   Generate load actors with force or moment.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-09
         */
        void generateGraphs();

        /**
         * @brief   Insert a new point and its value to points and data.[override]
         * @param   pos: The position of point
         * @param   modelId: The model id of this point
         * @param   addToLoadPoints: Add the point to the load points data.[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-09
         */
        void insertNextPoint(double* pos, int modelId, bool addToLoadPoints = true) override;

        /**
         * @brief   Initialize the actor's visualization properties.[override]
         * @param   actor: The actor
         * @param   details: Nothing[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-10
         */
        void initActorProperties(vtkProp* actor, QVariant details = QVariant()) override;

        /**
         * @brief   Check if the data has been changed for additional data.( Such as coodinate. )[override]
         * @return  Has been changed
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-29
         */
        bool checkDataChanged() override;

    private:
        /**
         * @brief   The force or moment value.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-10
         */
        double m_value[3]{ 0, 0, 0 };

        /**
         * @brief   The positive or negative directions of three directions.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-29
         */
        int m_symbolDirecs[3]{ 1, 1, 1 };

        /**
         * @brief   The coordinate transform data object.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-29
         */
        Interface::FITKCoordinateSystem* m_coordinate{ nullptr };

        /**
         * @brief   The coordinate system ID.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-29
         */
        int m_coordinateId = -1;

    };

    // Type define.
    typedef FITKGraphObjectLoad_F_M FITKGraphObjectLoadForce;
    typedef FITKGraphObjectLoad_F_M FITKGraphObjectLoadMoment;
}   // namespace Exchange

#endif // __FITKGRAPHOBJECTLOAD_F_M_H__
